import { createRouter, createWebHistory } from 'vue-router'

import LoginVue from '../views/Login.vue'
import LayoutVue from '../views/layout/Layout.vue';
import TeacherLayout from '../views/layout/TeacherLayout.vue';
import TeacherHome from '../views/home/TeacherHome.vue';
import TeacherResetPassword from '../views/teacher/TeacherResetPassword.vue';
import ArticleCategory from '../views/article/ArticleCategory.vue';
import ArticleManage from '../views/article/ArticleManage.vue';
import UserAvatar from '../views/user/UserAvatar.vue';
import UserInfo from '../views/user/UserInfo.vue';
import TeacherInfo from '../views/teacher/TeacherInfo.vue';
import UserResetPassword from '../views/user/UserResetPassword.vue';

//管理端
import Admin from '../views/user/Admin.vue';
import studentList from '../views/student/studentList.vue';
import teacherList from '../views/teacher/teacherList.vue';
import Home from '../views/home/Home.vue';
import noticeList from '../views/notice/notice.vue';
import Course from '../views/notice/course.vue';
import CourseStudent from '../views/notice/CourseStudent.vue';
import TeacherCourse from '../views/teacher/TeacherCourse.vue';
import Assingment from '../views/assignment/Assingment.vue';
import StudentAss from '../views/assignment/StudentAss.vue';
//学生端
import StudentLayout from '../views/layout/StudentLayout.vue';
import StudentHome from '../views/home/StudentHome.vue';
import StudentInfo from '../views/student/StudentInfo.vue';
import StudentResetPassword from '../views/student/StudentResetPassword.vue';
import StudentCourse from '../views/student/StudentCourse.vue';
import StudentHomework from '../views/student/StudentHomework.vue';
import AssCorrect from '../views/assignment/AssCorrect.vue';
import StudentScore from '../views/student/StudentScore.vue';
import Homework from '../views/student/Homework.vue';
import HwAnswer from '../views/student/HwAnswer.vue';
//定义路由关系
const routes = [
    { path: '/', component: LoginVue },
    { path: '/login', component: LoginVue },
    {
        path: '/home', component: LayoutVue,
        // 重定向 
        redirect: '/home',
        children: [
            {path:'/home',component:Home},
            { path:'/data',component:Home},
            { path: '/article/category', component: ArticleCategory },
            { path: '/article/manage', component: ArticleManage },
            {path:'/studentList',component:studentList},
            {path:'/teacherList',component:teacherList},
            {path:'/admin',component:Admin},
            {path:'/noticeList',component:noticeList},
            {path:'/course',component:Course},
            { path:'/course/student',component:CourseStudent},
            { path: '/user/avatar', component: UserAvatar },
            { path: '/user/info', component: UserInfo },
            { path: '/user/resetPassword', component: UserResetPassword },
        ]
    },
    {
        path: '/teacher', component: TeacherLayout,
        // 重定向 
        redirect: '/teacherHome',
        children: [
            {path:'/teacherHome',component:TeacherHome},
            { path: '/assignment', component: Assingment },
            { path: '/teacher/info', component: TeacherInfo },
            { path:'/teacherCourse',component:TeacherCourse},
            { path:'/teacherCourse/student',component:CourseStudent},
            { path:'/studentAss',component:StudentAss},
            { path: '/teacher/resetPassword', component: TeacherResetPassword },
        ]
    },
    {
        path: '/student', component: StudentLayout,
        // 重定向 
        redirect: '/studentHome',
        children: [
            { path:'/studentHome',component:StudentHome},
            { path: '/student/info', component: StudentInfo },
            { path: '/student/resetPassword', component: StudentResetPassword },
            { path:'/Studentcourse',component:StudentCourse},
            { path:'/StudentHomework',component:StudentHomework},
            {path:'/student/hw',component:Homework},
            { path:'/assCorrect',component:AssCorrect},
            { path:'/studentScore',component:StudentScore},
            { path:'/hwAnswer',component:HwAnswer}

        ]
    }
]
// 配置路由
const router = createRouter({
    history: createWebHistory(),
    routes: routes
})


export default router